import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'
import VueAxios from 'vue-axios'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

// import cookie from './uilt/cookie.js'//导入cookie
import echarts from 'echarts'
import Print from 'vue-print-nb'
import Vuei18n from "vue-i18n"//引入中英文
import ECharts from 'vue-echarts'//引用echarts
import myCharts from './uilt/myCharts.js'
Vue.use(myCharts)
require('echarts/lib/chart/bar')//按需引入
Vue.component('chart', ECharts) //注册
Vue.use(Print);  //注册
Vue.use(Vuei18n)
import {post,get} from './uilt/http' 

Vue.prototype.$post=post;
Vue.prototype.$get=get;
import has from './uilt/has'
Vue.use(Print);  //注册
Vue.use(Vuei18n)
console.log(has)


//中文切换
const i18n = new Vuei18n({
  locale: localStorage.getItem('locale') || 'zh',  // 语言标识，后面会用做切换和将用户习惯存储到本地浏览器
  messages: {
    "zh": require("./uilt/lang/zh"),
    "en": require("./uilt/lang/en")
  }
})
// //路由守卫

router.beforeEach((to, from, next) => {
	if(store.state.token !="" ||  sessionStorage.state!=undefined || to.path === "/login") {
		next()
	} else {
		next({
			path: "/login"
		})
	}
})


Vue.prototype.$echarts = echarts
Vue.config.productionTip = false

Vue.use(VueAxios, axios)
Vue.use(ElementUI)


new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app')
